package Map_;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class demo01 {
    public static void main(String[] args) {
        ArrayList<Map<String,Object>> objects = new ArrayList<>();



        HashMap<String, Object>  hashmap = new HashMap<>();
        hashmap.put("name","张三");
        hashmap.put("id",1);
        hashmap.put("age",18);
        objects.add(hashmap);


        HashMap<String, Object>  hashmap1 = new HashMap<>();
        hashmap1.put("name","王五");
        hashmap1.put("id",2);
        hashmap1.put("age",17);
        objects.add(hashmap1);


        //增强for循环
        /**1.遍历集合：for（数据类型  变量名：集合名）{  循环体    }
         * 2.遍历数组：for（数据类型  变量名：数组名）{  循环体    }
         * */
        for (Map<String,Object> map:objects) {

            System.out.println(map);

        }
    }
}
